package com.threeti.mecool.core.domain.model.plan.aspects;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.threeti.mecool.core.domain.model.plan.pojo.UserJob;
import com.threeti.mecool.core.infrastructure.persistence.plan.UserJobRepository;

privileged aspect UserJob_AJ_Domain {
	@JsonIgnore
	@Autowired
	private transient UserJobRepository UserJob.userJobRepository;
	
	static UserJobRepository UserJob.userJobRepository() {
		return new UserJob().userJobRepository;
	}
	
	@Transactional
	public void UserJob.save() {
		if (userJobRepository == null) {
			userJobRepository = userJobRepository();
		}
		userJobRepository.save(this);
	}
}
